home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / d.t.p / utils / propage / donsgenies / donsgenies.lha / Don'sGenies / PrintToLaserJetUsingPost.pprx < prev    next >
Text File  |  1993-05-25  |  3KB  |  78 lines

  1. /* This genie uses the public domain Postscript interpreter "Post" to print your document. The advantages are that you can print .eps files on a non-Postscript printer and that you can use real Type 1 fonts, rather than converted versions.  The files "post" and "init.ps" should be in a drawer called "post" in your "PPage:" drawer (if not, modify the indicated line in the genie), the necessary .psfont files in CGFonts:ps, and "post.library" in libs:  You do NOT need "Conman". 
  2. Make sure the assigns for PPage: and CGFonts: are set up in your startup-sequence or user-startup files. 
  3. It is also essential to set the Limits in your printer graphics preferences to the correct page size in pixels i.e. the printer's dots-per-inch * page size in inches. Typical figures are 1500 by 2100. */
  4. /* Written by Don Cox. Not Public Domain. All rights reserved. */
  5.  
  6.  
  7. trace n
  8. signal on error
  9. signal on syntax
  10. address command
  11. call SafeEndEdit.rexx()
  12. call ppm_AutoUpdate(0)
  13. cr="0a"x
  14.  
  15. oldoutput = ppm_GetPSOutput()
  16. call ppm_SetPSOutput("PPage:temp.ps")
  17. call ppm_SetPSFontDownload(0)
  18. success = ppm_PrintDocPS(1,1)
  19. if success ~=1 then exit_msg("Failed saving temporary Postscript file.")
  20.  
  21. form = "Page size (0-7):3"cr"Portr./landsc. (P/L):P"cr"Start page:all"cr"End page:all"cr"Number of copies:1"cr"Compress on/off(1/0):1"cr"Destination:par"
  22.  
  23. form = ppm_GetForm("Printing setup...",7,form)
  24. if form = "" then exit_msg("Aborted by user")
  25. parse var form size "0a"x portrait "0a"x startpage "0a"x endpage "0a"x copies "0a"x compression "0a"x destination
  26. size = left(size,1)
  27. if verify(size,"01234567")~=0 then size = 3
  28. portrait = upper(left(portrait,1))
  29. if portrait = "L" then portrait = 1
  30. else portrait = 0
  31. if datatype(startpage,"N")=0 then startpage = 0
  32. if datatype(endpage,"N")=0 then endpage = 0
  33.  
  34. if datatype(copies,"N")=0 then copies = 1
  35. if left(compression,1)~="0" then compression = 1
  36. destination = strip(destination,"T",":")
  37. if destination~="par" & destination~="ser" then do
  38.     destination = ppm_GetFileName("Set output file...","ram:","postljtest")
  39.     destination = '"'destination'"' /* So you can have spaces in file name */
  40.     end
  41. if destination = "ser" | destination = "par" then destination = destination":"
  42.  
  43. options = " -s"size" -a"portrait" -b"startpage" -e"endpage" -c"copies" -g"compression
  44. postcommand =  "postlj "options" init.ps PPage:temp.ps TO "destination
  45.  
  46. /* Set up a text file in ram: and then send it to a temporary command window */
  47. conwindow = "CON:40/40/500/200/NewWindow"
  48. call open out, "ram:temp", write  /* This wipes out any existing ram:temp  */
  49. call writeln out, "cd PPage:Post" /* post is in drawer "Post" in "PPage:" - if not, change this line  */
  50. call writeln(out, postcommand) /* To use lots of fonts in one document, add memory to Post here. See Post documentation. */
  51. call writeln out, "delete PPage:temp.ps"
  52. call writeln out, "endcli"  /* if you have problems, comment this line out so the CLI stays on screen with Post error mesages */
  53. call close out
  54. "newcli" conwindow "ram:temp" /* open a CLI and use ram:temp as a set of commands */
  55.  
  56. call ppm_SetPSOutput(oldoutput)
  57. call exit_msg()
  58.  
  59. end
  60.  
  61. error:
  62. syntax:
  63.     do
  64.     exit_msg("Genie failed due to error: "errortext(rc))
  65.     end
  66.  
  67. exit_msg:
  68.     do
  69.     parse arg message
  70.     if message ~= "" then
  71.     call ppm_Inform(1,message)
  72.     call ppm_ClearStatus()
  73.     call ppm_PPageToFront()
  74.     call ppm_AutoUpdate(1)
  75.     exit
  76.     end
  77.  
  78.